﻿using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WatiN.Core;
using Microsoft.Practices.Unity;

namespace Catchbase.Web.ATest
{
    [TestClass]
    public class Setup
    {
        private static int _browserProcessId;

        [AssemblyInitialize]
        public static void InitializeAssembly(TestContext context)
        {
            var browser = IoC.Container.Resolve<Browser>();
            _browserProcessId = browser.ProcessID;
        }

        [AssemblyCleanup]
        public static void CleanupAssembly()
        {
            IoC.Container.Dispose();
            var process = Process.GetProcessById(_browserProcessId);
            if (!process.HasExited) process.Kill();
        }
    }
}